const {
  houseList_mock
} = require("../../../mock/house.js")
const {
  baseUrl,
  getRequest,
  postRequest
} = require("../../../utils/request.js")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //房源列表
    houseList: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.http_collection_findAllByUserId()
    this.setData({
      //houseList: houseList_mock
    })
  },
  /**
   * 根据用户id查询收藏的房源
   */
  http_collection_findAllByUserId() {
    wx.getStorage({ 
      key: "userId",
      success: res => {
        //console.log(res.data)
        getRequest(baseUrl+"/front/collection/findAllByUserId",{
          userId:res.data
        }).then(res=>{
          if(res.code==200){
            this.setData({
              houseList:res.data
            })
          }
        })
      }
    })
  },
})